package com.example.zhangxin.myhuatuob2b.bean;

import org.json.JSONException;
import org.json.JSONObject;

/**
 * Created by ZhangXin on 2016/10/12.
 */

public class Home6Data {

    public static final String TITLE = "title";
    public static final String RECTANGLE1_IMAGE = "rectangle1_image";
    public static final String RECTANGLE1_TYPE = "rectangle1_type";
    public static final String RECTANGLE1_DATA = "rectangle1_data";
    public static final String RECTANGLE2_IMAGE = "rectangle2_image";
    public static final String RECTANGLE2_TYPE = "rectangle2_type";
    public static final String RECTANGLE2_DATA = "rectangle2_data";
    private String title;
    private String rectangle1_image;
    private String rectangle1_type;
    private String rectangle1_data;
    private String rectangle2_image;
    private String rectangle2_type;
    private String rectangle2_data;

    public Home6Data() {
    }

    public Home6Data(String title, String rectangle1_image, String rectangle1_type, String rectangle1_data, String rectangle2_image, String rectangle2_type, String rectangle2_data) {
        this.title = title;
        this.rectangle1_image = rectangle1_image;
        this.rectangle1_type = rectangle1_type;
        this.rectangle1_data = rectangle1_data;
        this.rectangle2_image = rectangle2_image;
        this.rectangle2_type = rectangle2_type;
        this.rectangle2_data = rectangle2_data;
    }

    public static Home6Data newInstanceList(String json) {
        Home6Data bean = null;
        try {
            JSONObject obj = new JSONObject(json);
            if (obj.length() > 0) {

                String title = obj.optString(TITLE);
                String rectangle1_image = obj.optString(RECTANGLE1_IMAGE);
                String rectangle1_type = obj.optString(RECTANGLE1_TYPE);
                String rectangle1_data = obj.optString(RECTANGLE1_DATA);

                String rectangle2_image = obj.optString(RECTANGLE2_IMAGE);
                String rectangle2_type = obj.optString(RECTANGLE2_TYPE);
                String rectangle2_data = obj.optString(RECTANGLE2_DATA);

                bean = new Home6Data(title, rectangle1_image, rectangle1_type, rectangle1_data, rectangle2_image, rectangle2_type, rectangle2_data);
            }
        } catch (JSONException e) {
            e.printStackTrace();
        }
        return bean;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getRectangle1_type() {
        return rectangle1_type;
    }

    public void setRectangle1_type(String rectangle1_type) {
        this.rectangle1_type = rectangle1_type;
    }

    public String getRectangle1_image() {
        return rectangle1_image;
    }

    public void setRectangle1_image(String rectangle1_image) {
        this.rectangle1_image = rectangle1_image;
    }

    public String getRectangle1_data() {
        return rectangle1_data;
    }

    public void setRectangle1_data(String rectangle1_data) {
        this.rectangle1_data = rectangle1_data;
    }

    public String getRectangle2_image() {
        return rectangle2_image;
    }

    public void setRectangle2_image(String rectangle2_image) {
        this.rectangle2_image = rectangle2_image;
    }

    public String getRectangle2_type() {
        return rectangle2_type;
    }

    public void setRectangle2_type(String rectangle2_type) {
        this.rectangle2_type = rectangle2_type;
    }

    public String getRectangle2_data() {
        return rectangle2_data;
    }

    public void setRectangle2_data(String rectangle2_data) {
        this.rectangle2_data = rectangle2_data;
    }
}
